package com.project.consumer.controller;

import com.project.base.Result;
import com.project.entity.UserEntity;
import com.project.service.DubboUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

@Api(tags = "User Module", value = "用户Controller")
@RestController
@RequestMapping("/user")
public class UserController {

    @DubboReference(version = "1.0.0", check = false, loadbalance = "random")
    private DubboUserService userService;

    @ApiOperation(value = "get访问接口")
    @GetMapping("/get")
    public String get() {
        return userService.get();
    }

    @ApiOperation(value = "新增用户")
    @PostMapping("/insert")
    public Result insert(@RequestBody UserEntity userEntity) {
        return Result.success(userService.insert(userEntity));
    }


}
